package com.project.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
@SuppressWarnings("all")
@RestController
public class uploadController {
    @RequestMapping("upload")
    public String upload(@RequestParam("uploadImg") MultipartFile mf) throws IOException {
        String filename = mf.getOriginalFilename();

        filename = System.currentTimeMillis() + filename.substring(filename.lastIndexOf("."));
        mf.transferTo(new File("D:\\JavaPlus\\javaWEB\\BBS\\faceImg" + filename));
        return filename;
    }
}
